package org.duang.kit;

import java.util.HashMap;
import java.util.Map;

public class DuangMap {

	private static Map<String, String> _duangMap = null;
	private static DuangMap duangMap = null;

	public static DuangMap duang() {
		synchronized (duangMap) {
			return init(0);	
		}
	}

	public static DuangMap duang(int size) {
		synchronized (duangMap) {
			return init(size);
		}
	}
	
	private static DuangMap init(int size) {
		duangMap = new DuangMap();
		_duangMap = (size == 0) ? new HashMap<String, String>() : new HashMap<String, String>(size);
		return duangMap;
	}

	public DuangMap put(String key, String value) {
		_duangMap.put(key, value);
		return this;
	}

	public Map<String, String> getMap() {
		return _duangMap;
	}

	public String getJson() {
		return ToolsKit.toJsonString(_duangMap);
	}

}
